package org.fujay.langchain4jserver.domain.knowledge.vo;

import java.io.Serial;
import java.io.Serializable;

/**
 * 文档数量值对象
 */
public record DocumentCount(int value) implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    public DocumentCount {
        if (value < 0) {
            throw new IllegalArgumentException("Document count cannot be negative");
        }
    }

    public static DocumentCount zero() {
        return new DocumentCount(0);
    }

    public DocumentCount increment() {
        return new DocumentCount(this.value + 1);
    }

    public DocumentCount decrement() {
        return new DocumentCount(Math.max(0, this.value - 1));
    }
}
